﻿using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using NHibernate.Criterion;

namespace ShopSpace.Infrastructure.Data
{
	public interface IGenericDAO
	{
		long Count<T>(Expression<Func<T, bool>> where);
		void Delete<T>(T target);
		T Find<T>(object id);
		T FindFirst<T>(Expression<Func<T, bool>> where);
		T FindUnique<T, U>(Expression<Func<T, U>> expression, U search) where T : class;
		IQueryable<T> AsQueryable<T>();
		void Save<T>(T target);
		T[] Query<T>(Expression<Func<T, bool>> where);
		IList<T> ListbyCriteria<T>(DetachedCriteria criteria);
	}
}